beta gammaQ gammaP atan2 hypot Y K max min I J nsqrt